package com.hzdesk.media.matvector.koreabatch.client.my_paperless.adapter;

import android.content.Context;
import android.graphics.Paint;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;

import com.hzdesk.media.matvector.koreabatch.client.my_paperless.R;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.base.BaseAdapter;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.base.BaseViewHolder;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.bean.DevicesManagerBean;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.view_holder.DevicesManagerViewHolder;

/**
 * Created by Administrator on 2018/8/9.
 * 杭州席媒科技有限公司  Developers  刘传华  10
 * 佛祖镇楼 bug辟易
 *
 *
 * @DESC 设备页面适配器  T 是数据类型 等有数据类型要改过来
 */

public class DevicesManagerAdapter<T>extends BaseAdapter{
    public DevicesManagerAdapter(Context mContext) {
        super(mContext);
    }

    @Override
    protected int getItemLayout() {
        return R.layout.devices_manager;
    }

    @Override
    protected BaseViewHolder getItemViewHolder(View view) {
        return new DevicesManagerViewHolder(view);
    }

    @Override
    protected void onMyBindViewHolder(BaseViewHolder holder, final int position) {
        DevicesManagerViewHolder mDevicesManagerViewHolder = (DevicesManagerViewHolder) holder;
        DevicesManagerBean bean = (DevicesManagerBean) mlist.get(position);
        double hardDiskSize =  bean.getHardDiskSize();
        double localStoreUseSize =  bean.getLocalStoreUseSize();
        int meetingNumber =  bean.getMeetingNumber();
        mDevicesManagerViewHolder.getTv_few().setText("共"+meetingNumber+"场");
        double progress =  (localStoreUseSize/hardDiskSize);
        mDevicesManagerViewHolder.getTv_progress().setText((int)(progress*100)+"%");
        mDevicesManagerViewHolder.getPg().setProgress((int) (progress*100));
        mDevicesManagerViewHolder.getTv_content().setText(localStoreUseSize+"GB/"+hardDiskSize+"GB");
        mDevicesManagerViewHolder.getIv_right_rsetting().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(mIonClickedItemListenter != null){
                    mIonClickedItemListenter.onClickedFist(position);
                }
            }
        });
        mDevicesManagerViewHolder.getRl_right().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(mIonClickedItemListenter != null){
                    mIonClickedItemListenter.onClickedSecond(position);
                }
            }
        });
    }

}
